import sys

x,y = map(int,input().split())

print(x and y)
print(x or y)
print(not x)
print(not y)